<style type="text/css">
</style>

<div class="filter">
    <div class="f1 item">
        <input type="text" class="am-form-field" placeholder="起始日期" id="start"
            data-am-datepicker="{theme:'success'}" readonly required />
    </div>
    <div class="f2 item">
        <input type="text" class="am-form-field" placeholder="结束日期" id="end"
            data-am-datepicker="{theme:'success'}" readonly required />
    </div>

    <div class="button item">
        <button type="button" class="am-btn am-btn-primary">查看</button>
    </div>

    <div class="clear"></div>
</div>

<table class="am-table am-table-bordered am-table-striped am-table-compact" id="result-table">
  <thead>
  <tr>
    <th width="120px">时间</th>
    <th width="90px">抽水金额</th>
    <th width="90px">余额</th>
    <th>备注</th>
  </tr>
  </thead>
<tbody>
  </tbody>
</table>
<div class="zxf_pagediv"></div>

<script src="../public/all/js/page_list.js"></script>
<script>
    $(".f1 input").datepicker({format: 'yyyy-mm-dd'});
    $(".f2 input").datepicker({format: 'yyyy-mm-dd'});

    var _f = Util.queryTemplate($("#result-table tbody"), ".zxf_pagediv", $(".button button"), function(page, size, cb) {
        var start = $("#start").val(),
            end = $("#end").val();
        var data = {
            type: "fee",
            pageSize: size,
            pageNum: page,
        };
        if (start) data.start = start;
        if (end) data.end = end;

        startLoading();
        CMD.query_account_log2(data, function(r) {
            stopLoading();
            cb(r);
        })
    }, function(table, list, sum) {
        if (Util.isEmpty(list)) {
            table.append("<tr><td colspan='4'>暂无数据</tr>");
            return;
        }

        // sum
        var tr = $("<tr></tr>");
        tr.append("<td>合计</td>");
        tr.append("<td>" + (sum / 100) + "</td>");
        tr.append("<td colspan='2'></td>");
        table.append(tr);

        for (var i in list) {
            var d = list[i];
            var tr = $("<tr></tr>");
            tr.append("<td>" + d.end + "</td>");
            tr.append("<td>" + (d.amount/100).toFixed(2) + "</td>");
            tr.append("<td>" + (d.balance/100).toFixed(2) + "</td>");
            
            var memo = get_game_display_name(d.lottery) + " 第" + d.issue + "期";
            tr.append("<td>" + memo + "</td>");
            table.append(tr);
        }
    });
</script>

